/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: LoginController
 * @Package com.rx.uua.controller
 * @Description: 登录
 * @author: 陈锦韬
 * @date: 2021\6\26 0026
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.uua.controller;

import com.rx.core.base.RxBaseController;
import com.rx.core.data.UrlAnalyse;
import com.rx.core.dbase.mutil.param.DoubleInnerParameter;
import com.rx.core.enm.RX_VALID;
import com.rx.uua.dao.UuaOrgInfoMapper;
import com.rx.uua.service.SystemService;
import com.rx.uua.vo.*;
import com.rx.uua.vo.relation.DoubleUuaOrgInfo;
import com.rx.uua.vo.relation.DoubleUuaUserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Administrator
 * @Description: 系统管理
 * @date: 2021\6\26 0026
 */
@RestController
@RequestMapping("system")
public class SystemController extends RxBaseController {

    @Autowired
    SystemService systemService;

    @Autowired
    UuaOrgInfoMapper mapper;


    @PostMapping("/change-password")
    public Object changePassword(@RequestBody ChangePasswordVo changePasswordVo){
      return  systemService.changePassword(changePasswordVo);
    }


    @PostMapping("/search-menu")
    public Object searchMenu(@RequestBody UuaOrgInfo uuaOrgInfo){
        return  systemService.searchMenu(uuaOrgInfo);
    }

    @PostMapping("/test")
    public Object test(@RequestBody DoubleUuaOrgInfo rxBaseData){
        UrlAnalyse url = UrlAnalyse.create("/rx-standard-api/double/uua-org-info/urg0000/inner-search-list");
        rxBaseData.setUrlAnalyse(url);
        rxBaseData.setValid(RX_VALID.NORMAL.getCode());

        UuaRelGroup uuaRelGroup = new UuaRelGroup();
        uuaRelGroup.setValid(RX_VALID.NORMAL.getCode());
        uuaRelGroup.setGroupBid("4e9b4c9b-e150-11eb-ae68-00ffcfc92874");
        rxBaseData.assignRelation(uuaRelGroup);
        List object= mapper.innerSearchList(DoubleInnerParameter.build(rxBaseData));
        System.out.println(object);
        return  object;
    }

    @PostMapping("/select-user")
    public Object selectUser(@RequestBody DoubleUuaUserInfo doubleUuaUserInfo){
        return  systemService.selectUser(doubleUuaUserInfo);
    }
    @PostMapping("/select-user-role")
    public Object selectUserRole(@RequestBody DoubleUuaUserInfo doubleUuaUserInfo){
        return  systemService.selectUserRole(doubleUuaUserInfo);
    }
    @PostMapping("/select-user-post")
    public Object selectUserPost(@RequestBody DoubleUuaUserInfo doubleUuaUserInfo){
        return  systemService.selectUserPost(doubleUuaUserInfo);
    }

    @PostMapping("/org-user-count")
    public Object orgUserCount(@RequestBody @Param("bidList") List<String> bidList){
        return  systemService.orgUserCount(bidList);
    }


}
